package com.zhcd.sys.controller;

import com.zhcd.sys.pojo.Catalog;
import com.zhcd.sys.service.CatalogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
@RequestMapping("/")
public class AllController {
    @Autowired
    private CatalogService catalogService;

    //跳转登录页
    @RequestMapping("/login")
    public String toLogin(Model model){
        return "Views/Login/login";
    }

    //跳转主页
    @RequestMapping("/home")
    public String toHome(Model model){
        List<Catalog> all_catalog = catalogService.getAll_UpNavCatalog(0);
        model.addAttribute("lists",all_catalog);
        return "Views/Home/home";
    }

    //注册
    @RequestMapping("/register")
    public String toRegister(Model model){
        return "Views/Register/register";
    }

    //跳转母页
    @RequestMapping("/mattress_management")
    public String toMattress_Management(Model model, HttpServletRequest request){
        int id =  Integer.parseInt(request.getParameter("id"));
        List<Catalog> all_catalog = catalogService.getAll_UpNavCatalog(id);
        model.addAttribute("lists",all_catalog);
        return "Views/monitor/mattress_management";
    }

    //跳转收费数据分析
    @RequestMapping("/charge/data_charge")
    public String toData_Charge(){
        return "Views/monitor/charge/data_charge";
    }

    //跳转收费明细
    @RequestMapping("/charge/detailed_charge")
    public String toDetailed_Charge(){
        return "Views/monitor/charge/detailed_charge";
    }

    //跳转缴费明细
    @RequestMapping("/charge/detailed_charge_details")
    public String toDetailed_Charge_Details(){
        return "Views/monitor/charge/detailed_charge_details";
    }

    //跳转账户信息
    @RequestMapping("/charge/info_charge")
    public String toInfo_Charge(){
        return "Views/monitor/charge/info_charge";
    }

    //跳转增加医生
    @RequestMapping("/doctor/add_dortor")
    public String toAdd_Dortor(){
        return "Views/monitor/doctor/add_dortor";
    }

    //跳转管理医生
    @RequestMapping("/doctor/admin_dortor")
    public String toAdmin_Dortor(){
        return "Views/monitor/doctor/admin_dortor";
    }

    //跳转查询医生
    @RequestMapping("/doctor/sel_dortor")
    public String toSel_Dortor(){
        return "Views/monitor/doctor/sel_dortor";
    }

    //跳转添加患者
    @RequestMapping("/patient/add_patient")
    public String toAdd_Patient(){
        return "Views/monitor/patient/add_patient";
    }

    //跳转患者数据
    @RequestMapping("/patient/data_patient")
    public String toData_Patient(){
        return "Views/monitor/patient/data_patient";
    }

    //跳转查询患者
    @RequestMapping("/patient/sel_patient")
    public String toSel_Patient(){
        return "Views/monitor/patient/sel_patient";
    }

    //跳转患者一览
    @RequestMapping("/patient/selAndupd_patient")
    public String toSelAndupd_Patient(){
        return "Views/monitor/patient/selAndupd_patient";
    }

    //跳转床垫一览
    @RequestMapping("/mattress/selAndupd_mattress")
    public String toSelAndupd_Mattress(){
        return "Views/monitor/mattress/selAndupd+mattress";
    }

    //跳转床垫查询
    @RequestMapping("/mattress/sel_mattress")
    public String toSel_Mattress(){
        return "Views/monitor/mattress/sel_mattress";
    }

    //跳转添加床垫
    @RequestMapping("/mattress/add_mattress")
    public String toAdd_Mattress(){
        return "Views/monitor/mattress/add_mattress";
    }

}
